/* JavaLog - package tracker 
 * 
 * Copyright (C) 2009  Allyson Lima, Diego Pedro, Victor Freire
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software 
 * Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this 
 * program.  If not, see <http://www.gnu.org/licenses/>.
 */
package br.edu.ufcg.ccc.javalog.view;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import br.edu.ufcg.ccc.javalog.model.Package;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
/** 
 * View for a Package model object.
 * @author Allyson Lima, Diego Pedro, Victor Freire
 * @version 03/12/09 
 */
@SuppressWarnings("serial") // not serializing this...
public class PackageView extends AbstractView {
	private Package pkg;
	//private PackageController package;
	
	private JTextField textNumber;
	private JTextField textDistrict2;
	private JLabel labelZipcode;
	private JButton buttonTrackingReport;
	private AbstractAction actionBack;
	private JButton buttonBack;
	private JLabel labelIDShow;
	private JLabel labelID;
	private JButton buttonCurrentFranchise;
	private JLabel labelCurrentFranchise;
	private JLabel jLabel4;
	private JLabel jLabel5;
	private JLabel labelDestinationFranchise;
	private JLabel labelSourceFranchise;
	private JLabel labelRegion;
	private JButton buttonDestinationFranchise;
	private JButton buttonSourceFranchise;
	private JComboBox comboPackageType;
	private JLabel labelSourceAddress;
	private JLabel jLabel3;
	private JLabel labelDistrict;
	private JLabel labelStreet;
	private JLabel jLabel2;
	private JFormattedTextField textZipcode2;
	private JTextField textStreet2;
	private JFormattedTextField textZipcode;
	private JTextField textDistrict;
	private JTextField textStreet;
	private JLabel jLabel1;
	private JLabel labelNumber;
	private JTextField textNumber2;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				PackageView inst = new PackageView();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	private PackageView() {
		super();
		initGUI();
	}
	
	public PackageView(Package p) {
		this();
		this.pkg = p;
		refreshView();
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				textNumber = new JTextField();
				textNumber.setEditable(false);
			}
			{
				textNumber2 = new JTextField();
				textNumber2.setEditable(false);
			}
			{
				labelNumber = new JLabel();
				labelNumber.setText("Nº:");
			}
			{
				jLabel1 = new JLabel();
				jLabel1.setText("Nº:");
			}
			{
				textStreet = new JTextField();
				textStreet.setEditable(false);
			}
			{
				textDistrict = new JTextField();
				textDistrict.setEditable(false);
			}
			{
				textZipcode = new JFormattedTextField(ViewUtil
						.getZipcodeFormatter());
				textZipcode.setEditable(false);
			}
			{
				textStreet2 = new JTextField();
				textStreet2.setEditable(false);
			}
			{
				textDistrict2 = new JTextField();
				textDistrict2.setEditable(false);
			}
			{
				textZipcode2 = new JFormattedTextField(ViewUtil
						.getZipcodeFormatter());
				textZipcode2.setEditable(false);
			}
			{
				jLabel2 = new JLabel();
				jLabel2.setText("Destinatário");
				jLabel2.setFont(new java.awt.Font("Tahoma",1,12));
			}
			{
				buttonBack = new JButton();
				buttonBack.setText("Voltar");
				buttonBack.setAction(getActionBack());
			}
			{
				labelCurrentFranchise = new JLabel();
				labelCurrentFranchise.setText("Posição:");
			}
			{
				buttonCurrentFranchise = new JButton();
				buttonCurrentFranchise.setText("Posição");
				buttonCurrentFranchise.setEnabled(false);
				buttonCurrentFranchise.setFont(new java.awt.Font("Tahoma",1,11));
			}
			{
				labelID = new JLabel();
				labelID.setText("ID");
				labelID.setFont(new java.awt.Font("Tahoma",1,12));
			}
			{
				labelIDShow = new JLabel();
				labelIDShow.setText("ID:");
			}
			{
				labelStreet = new JLabel();
				labelStreet.setText("Endereço:");
			}
			{
				labelDistrict = new JLabel();
				labelDistrict.setText("Bairro:");
			}
			{
				labelZipcode = new JLabel();
				labelZipcode.setText("CEP:");
			}
			{
				jLabel3 = new JLabel();
				jLabel3.setText("Endereço:");
			}
			{
				jLabel4 = new JLabel();
				jLabel4.setText("Bairro:");
			}
			{
				jLabel5 = new JLabel();
				jLabel5.setText("CEP:");
			}
			{
				labelSourceAddress = new JLabel();
				labelSourceAddress.setText("Remetente");
				labelSourceAddress.setFont(new java.awt.Font("Tahoma",1,12));
			}
			{
				ComboBoxModel comboPackageTypeModel = 
					new DefaultComboBoxModel(
							new String[] {"Tipo do pacote"});
				comboPackageType = new JComboBox();
				comboPackageType.setModel(comboPackageTypeModel);
				comboPackageType.setEnabled(false);
			}
			{
				buttonSourceFranchise = new JButton();
				buttonSourceFranchise.setText("Clique aqui para definir a origem");
				buttonSourceFranchise.setEnabled(false);
				buttonSourceFranchise.setFont(new java.awt.Font("Tahoma",1,11));
			}
			{
				buttonDestinationFranchise = new JButton();
				buttonDestinationFranchise.setText("Clique aqui para definir o destino");
				buttonDestinationFranchise.setEnabled(false);
				buttonDestinationFranchise.setFont(new java.awt.Font("Tahoma",1,11));
			}
			{
				labelRegion = new JLabel();
				labelRegion.setText("Tipo da encomenda:");
			}
			{
				labelSourceFranchise = new JLabel();
				labelSourceFranchise.setText("Franquia de Origem:");
			}
			{
				labelDestinationFranchise = new JLabel();
				labelDestinationFranchise.setText("Franquia de Destino:");
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(comboPackageType, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelRegion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelID, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelIDShow, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(20)
				.addComponent(labelSourceAddress, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(textNumber, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelNumber, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(textStreet, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelStreet, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(textDistrict, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelDistrict, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(textZipcode, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelZipcode, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(35)
				.addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(textNumber2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(textStreet2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(jLabel3, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(textDistrict2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(jLabel4, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(textZipcode2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(jLabel5, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(23)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(buttonSourceFranchise, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelSourceFranchise, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(buttonDestinationFranchise, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelDestinationFranchise, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(buttonCurrentFranchise, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(labelCurrentFranchise, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addGap(18)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(buttonBack, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getButtonTrackingReport(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addContainerGap(21, 21));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup()
				            .addComponent(labelCurrentFranchise, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(labelDestinationFranchise, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE)
				                .addGap(12))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(labelSourceFranchise, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE)
				                .addGap(12))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(labelRegion, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE)
				                .addGap(12)))
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(buttonCurrentFranchise, 0, 466, Short.MAX_VALUE)
				                .addGap(13))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(buttonDestinationFranchise, 0, 466, Short.MAX_VALUE)
				                .addGap(13))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(buttonSourceFranchise, 0, 466, Short.MAX_VALUE)
				                .addGap(13))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(comboPackageType, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE)
				                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				                .addComponent(labelIDShow, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
				                .addGap(7)
				                .addGroup(thisLayout.createParallelGroup()
				                    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                        .addGap(0, 0, Short.MAX_VALUE)
				                        .addComponent(getButtonTrackingReport(), GroupLayout.PREFERRED_SIZE, 226, GroupLayout.PREFERRED_SIZE)
				                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
				                        .addComponent(buttonBack, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE))
				                    .addComponent(labelID, GroupLayout.Alignment.LEADING, 0, 309, Short.MAX_VALUE)))))
				    .addGroup(thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup()
				            .addComponent(labelSourceAddress, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE)
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(jLabel5, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				                .addGap(31))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(jLabel4, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				                .addGap(31))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				                .addGap(31))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(labelZipcode, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				                .addGap(31))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(labelDistrict, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				                .addGap(31))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(labelStreet, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				                .addGap(31))
				            .addComponent(jLabel2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE))
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textZipcode2, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 182, Short.MAX_VALUE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textDistrict2, GroupLayout.PREFERRED_SIZE, 153, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 136, Short.MAX_VALUE))
				            .addComponent(textStreet2, GroupLayout.Alignment.LEADING, 0, 289, Short.MAX_VALUE)
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textZipcode, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 182, Short.MAX_VALUE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textDistrict, GroupLayout.PREFERRED_SIZE, 153, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 136, Short.MAX_VALUE))
				            .addComponent(textStreet, GroupLayout.Alignment.LEADING, 0, 289, Short.MAX_VALUE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addGroup(thisLayout.createParallelGroup()
				            .addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
				            .addComponent(labelNumber, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
				        .addGroup(thisLayout.createParallelGroup()
				            .addComponent(textNumber2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)
				            .addComponent(textNumber, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE))
				        .addGap(114)))
				.addContainerGap());
			pack();
			this.setSize(640, 500);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/**
	* This method should return an instance of this class which does 
	* NOT initialize it's GUI elements. This method is ONLY required by
	* Jigloo if the superclass of this class is abstract or non-public. It 
	* is not needed in any other situation.
	 */
	public static Object getGUIBuilderInstance() {
		return new PackageView(Boolean.FALSE);
	}
	
	/**
	 * This constructor is used by the getGUIBuilderInstance method to
	 * provide an instance of this class which has not had it's GUI elements
	 * initialized (ie, initGUI is not called in this constructor).
	 */
	private PackageView(Boolean initGUI) {
		super();
	}
	
	private void refreshView() {
		if(pkg == null) {
			JOptionPane.showMessageDialog(this, "Falha ao tentar acessar dados.", "Erro", JOptionPane.ERROR_MESSAGE);
			return;
		}
		this.setTitle(String.format("Encomenda %s:   %s", pkg.getType(), pkg.getID()));
		textStreet.setText(pkg.getSenderAddress().getStreet());
		textDistrict.setText(pkg.getSenderAddress().getDistrict());
		textNumber.setText(pkg.getSenderAddress().getNumber());
		textZipcode.setText(pkg.getSenderAddress().getZipcode());
		textStreet2.setText(pkg.getRecipientAddress().getStreet());
		textDistrict2.setText(pkg.getRecipientAddress().getDistrict());
		textNumber2.setText(pkg.getRecipientAddress().getNumber());
		textZipcode2.setText(pkg.getRecipientAddress().getZipcode());
		labelID.setText(pkg.getID());
		buttonSourceFranchise.setText(pkg.getSourceFranchise().toString());
		buttonDestinationFranchise.setText(pkg.getDestinationFranchise().toString());
		buttonCurrentFranchise.setText(pkg.getCurrentFranchise().toString());
		comboPackageType.removeAllItems();
		comboPackageType.addItem(pkg.getType());
	}
	
	private AbstractAction getActionBack() {
		if(actionBack == null) {
			actionBack = new AbstractAction("Voltar", null) {
				public void actionPerformed(ActionEvent evt) {
					dispose();
				}
			};
			actionBack.putValue(javax.swing.Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_V));
		}
		return actionBack;
	}
	
	private JButton getButtonTrackingReport() {
		if(buttonTrackingReport == null) {
			buttonTrackingReport = new JButton();
			buttonTrackingReport.setText("Ver Relatório");
		}
		return buttonTrackingReport;
	}

}
